#! /usr/bin/env python3

import rospy
# 加载SimpleActionClient
import actionlib
from reinovo_web.msg import startup_nodeAction,SN_state,startup_nodeGoal

def fibonacci_client():
    client = actionlib.SimpleActionClient('/statupNode', startup_nodeAction)
    print('wait_server')
    client.wait_for_server()
    print('server_is_active')
    # launchList = ['roslaunch bobac3_navigation bobac3_nav_2d.launch open_nav_rviz:=false map_file_name:=map.yaml']
    launchList = ['roslaunch rei_robot_base base.launch','roslaunch robot_joy robot_joy.launch']
    # launchList = ['roslaunch robot_joy robot_joy.launch']
    # 创建一个目标发送到行为服务器。
    goal = startup_nodeGoal(launchList)

    # 发送目标到行为服务器。
    client.send_goal(goal)

    # 等待服务器完成处理行为。
    client.wait_for_result()
    print('--------------------------------------------')

    # 打印运行行为结果。
    return client.get_result()  # A FibonacciResult

if __name__ == '__main__':
    try:
        rospy.init_node('fibonacci_client_py')
        result = fibonacci_client()
    except rospy.ROSInterruptException:
        print("program interrupted before completion")